package number_operatation.nowcoder.easy;

import java.util.Scanner;

/**
 * @author bruin_du
 * @description 查找输入整数二进制中1的个数
 * https://www.nowcoder.com/practice/1b46eb4cf3fa49b9965ac3c2c1caf5ad?
 * tpId=37&&tqId=21285&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking
 * @date 2022/5/15 22:29
 **/
public class CountNumberOf1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int num = in.nextInt();
            int count = 0;
            while(num != 0){
                num = (num - 1) & num;
                count++;
            }
            System.out.println(count);
        }
    }
}
